<?php
session_start();

include_once 'recursos/config.php';
$conf = new configuracion();
$dominio = $conf->getG2uDominio()."/";
$temp = "";

$cant_like = "A&uacute;n no hay Me gusta";
$who_like = "";
$user_has_liked = false;
if (is_array($_SESSION["g2uActualPhotoLike"]) && !empty($_SESSION["g2uActualPhotoLike"])) {
    $cant_like = count($_SESSION["g2uActualPhotoLike"]);
    $cant_like .= " <img src=\'".$dominio."images/png/estrella.png\' />";
    
    $cant_like2 = " <img src=\'".$dominio."images/png/estrella.png\' />";
    $cant_like2 .= count($_SESSION["g2uActualPhotoLike"]);
    
    foreach ($_SESSION["g2uActualPhotoLike"] as $key => $value) {
        $temp[$value['usuario']] = $value['usuario'];
        if($value['uid'] == $_SESSION["g2uId"]){
            $user_has_liked = true;
        }
    }
    foreach ($temp as $key => $value) {
        $who_like .= $value."<br/>";
    }
}
?>
<script>
    $("#l_cont").html('<span title="<?=$who_like?>" alt="<?=$who_like?>"> <?=$cant_like?> </span>');
    $("#l_cont_<?=$_REQUEST["id"]?>").html('<span title="<?=$who_like?>" alt="<?=$who_like?>"> <?=$cant_like2?> </span>');
    $('span').tipsy({html: true });
</script>
    <? if($_REQUEST["news"]<>1){ ?>
        <? if(!$user_has_liked){ ?>
             Me Gusta
        <? }else{ ?>
             Ya no me gusta.
        <? } ?>
    <? } ?>